package com.example.controller;

import com.example.common.Result;
import com.example.entity.User;
import com.example.service.UserService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    UserService userService;


    @PostMapping("/login")
    public Result login(@RequestParam String code) {
        return userService.loginWithWeChat(code);
    }

    @PostMapping("/update")
    public Result updateUser(@RequestBody User user){
        return userService.updateUser(user);
    }

    @PostMapping("/get")
    public Result getUser(@RequestBody User user){
        return userService.getUser(user);
    }
}
